\hypertarget{struct___s_p_i___d_r_v}{\section{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V Struct Reference}
\label{struct___s_p_i___d_r_v}\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
}
\subsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
uint16\-\_\-t $\ast$ \hyperlink{struct___s_p_i___d_r_v_a8c2a4272a8f7cb28ef5cb93d2bbdfe7b}{R\-X\-\_\-\-Data}
\item 
uint16\-\_\-t \hyperlink{struct___s_p_i___d_r_v_ad272ecadea65ca00df2f0cc9e868ab66}{R\-X\-\_\-end\-\_\-data}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_a9dae312df8e91e96acbefc6054b9b33d}{R\-X\-\_\-\-Data\-\_\-\-Size}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_af48cc5f7cde524793956f5d7b3223b48}{R\-X\-\_\-\-Index}
\item 
uint16\-\_\-t $\ast$ \hyperlink{struct___s_p_i___d_r_v_aeeb6d504e17e93b5f68871a8902a1192}{T\-X\-\_\-\-Data}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_a60813ca9863f226c3985a2ea529d6699}{T\-X\-\_\-\-Data\-\_\-\-Size}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_abb6d2bd838d651ea1ce4f67842aa81c4}{T\-X\-\_\-\-Index}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_a76c0ed371181cdc8f053170de8144ca2}{Completed}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_a9ac4c1f881137da2601ed5d333bb5989}{State}
\item 
uint8\-\_\-t \hyperlink{struct___s_p_i___d_r_v_a47cd5611a81f1fdbfaaaf073dac0e975}{Error}
\item 
struct D\-S\-P\-I\-\_\-tag $\ast$ \hyperlink{struct___s_p_i___d_r_v_a38d77c111691a5a74542dd2ca9ccf6ce}{D\-S\-P\-I}
\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_aead12928b2c4e6898c71c73b32315770}{init} )(int8\-\_\-t, int32\-\_\-t)
\begin{DoxyCompactList}\small\item\em Initiatlisation method. Must be called before using the driver.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_aaa043d94a20a9a8b13a062be3944e679}{exchange} )(const uint16\-\_\-t $\ast$, uint16\-\_\-t $\ast$)
\begin{DoxyCompactList}\small\item\em Exchange data (Master). Allows a full-\/duplex 16-\/bit data transfer where the module is the master.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a247fbfc90fac794d9c14e81848e53443}{write} )(const uint16\-\_\-t $\ast$)
\begin{DoxyCompactList}\small\item\em Write data (Master). Allows a half-\/duplex data transmission where the module will transmit a 16-\/bit data to a slave.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a0394bc0b91f6bb1a769c0f6added863a}{read} )(uint16\-\_\-t $\ast$)
\begin{DoxyCompactList}\small\item\em Read data (Master). Allows a half-\/duplex data transmission where the module will receive a 16-\/bit data from a slave and send it an empty frame.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a086ad89b79b23005b984e80dc5e65b92}{show} )(const uint16\-\_\-t $\ast$, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Write data (Slave). The module will write the data to its T\-X\-\_\-\-Buffer as a slave, ready to be read by a master. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a9bb35941a1c307a87268f643dcf14397}{exchange\-\_\-array} )(const uint16\-\_\-t $\ast$, uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Exchange data array (Master). Allows a full-\/duplex data transmission where the module will transmit an array of 16-\/bit data to a slave and receive another. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a41173e3adcf94d40c1aaa34767bf638f}{write\-\_\-array} )(const uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Write data array (Master). Allows a half-\/duplex data transmission where the module will transmit an array of 16-\/bit data to a slave. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_acacca74950b68d3dfeeb4b43d5a17234}{read\-\_\-array} )(uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Read data array (Master). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a slave and send it empty frames. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a5f87e1c352b3224fe2a6bed5db0ccf12}{listen} )(uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Read data array, given size (Slave). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a master. Can be used for data sniffing. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_adca794807f12ed1014f0e08fbf17c695}{listen\-\_\-till} )(uint16\-\_\-t $\ast$, uint16\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Read data array, given terminating data (Slave). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a master until it receives a terminating data. Can be used for data sniffing. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
void($\ast$ \hyperlink{struct___s_p_i___d_r_v_aa5e2288fb7202e84696e40a0e35b16b7}{show\-\_\-array} )(const uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)
\begin{DoxyCompactList}\small\item\em Write data array (Slave). The module will write the data to its T\-X\-\_\-\-Buffer as a slave, ready to be read by a master.\-The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. \end{DoxyCompactList}\item 
\hypertarget{struct___s_p_i___d_r_v_a5684ac71e5067cfaf0edf2fd8870e871}{void($\ast$ \hyperlink{struct___s_p_i___d_r_v_a5684ac71e5067cfaf0edf2fd8870e871}{E\-O\-Q\-I\-\_\-\-Handler} )(void)}\label{struct___s_p_i___d_r_v_a5684ac71e5067cfaf0edf2fd8870e871}

\begin{DoxyCompactList}\small\item\em End of Queue Interrupt Handler (Unused). The handler is not vectored to the I\-N\-T\-C in this version. The user can activate it by modifying initialise\-\_\-\-S\-P\-I\-\_\-\-D\-R\-I\-V\-E\-R function and by adding a E\-O\-Q command to the final transmission in previous methods. \end{DoxyCompactList}\item 
\hypertarget{struct___s_p_i___d_r_v_ab88d0229b263cbe779f1a0ea8a1bb20c}{void($\ast$ \hyperlink{struct___s_p_i___d_r_v_ab88d0229b263cbe779f1a0ea8a1bb20c}{T\-C\-I\-\_\-\-Handler} )(void)}\label{struct___s_p_i___d_r_v_ab88d0229b263cbe779f1a0ea8a1bb20c}

\begin{DoxyCompactList}\small\item\em Transfer Complete Interrupt Handler. An interrupt handler that clears the flag and the proceeds on doing a treatment depending on the state of the driver. The user can customise and add new states if needed, current states are\-:\par
 0x\-F\-F\-: idle,\par
 0x01\-: master/slave tx\par
 0x02\-: slave rx(knowing array size)\par
 0x03\-: slave rx(knowing terminating data)\par
. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}


Definition at line 292 of file spi\-\_\-drv.\-h.



\subsection{Field Documentation}
\hypertarget{struct___s_p_i___d_r_v_a76c0ed371181cdc8f053170de8144ca2}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!Completed@{Completed}}
\index{Completed@{Completed}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{Completed}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t Completed}}\label{struct___s_p_i___d_r_v_a76c0ed371181cdc8f053170de8144ca2}
A flag to indicate transfer status\-:\par
 1\-: transfer completed,\par
 0\-: ongoing transfer(or never happened). 

Definition at line 302 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a38d77c111691a5a74542dd2ca9ccf6ce}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!D\-S\-P\-I@{D\-S\-P\-I}}
\index{D\-S\-P\-I@{D\-S\-P\-I}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{D\-S\-P\-I}]{\setlength{\rightskip}{0pt plus 5cm}struct D\-S\-P\-I\-\_\-tag$\ast$ D\-S\-P\-I}}\label{struct___s_p_i___d_r_v_a38d77c111691a5a74542dd2ca9ccf6ce}
A pointer to the D\-S\-P\-I module for accesing peripheral registers. 

Definition at line 306 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a47cd5611a81f1fdbfaaaf073dac0e975}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!Error@{Error}}
\index{Error@{Error}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{Error}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t Error}}\label{struct___s_p_i___d_r_v_a47cd5611a81f1fdbfaaaf073dac0e975}
An error flag. (Not used in this version.) 

Definition at line 305 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_aaa043d94a20a9a8b13a062be3944e679}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!exchange@{exchange}}
\index{exchange@{exchange}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{exchange}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ exchange)(const uint16\-\_\-t $\ast$, uint16\-\_\-t $\ast$)}}\label{struct___s_p_i___d_r_v_aaa043d94a20a9a8b13a062be3944e679}


Exchange data (Master). Allows a full-\/duplex 16-\/bit data transfer where the module is the master.\par
. 

\begin{DoxyVerb}                            Example: SPI[0].exchange(&command, &status); 
                            A command is sent and status of the slave is received.
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em int16\-\_\-t$\ast$} & T\-X\-\_\-data \-: give the adress of the T\-X data to be sent,\par
 \\
\hline
{\em int16\-\_\-t$\ast$} & R\-X\-\_\-data \-: give the adress where R\-X data will be stored.\par
 \\
\hline
\end{DoxyParams}


Definition at line 317 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a9bb35941a1c307a87268f643dcf14397}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!exchange\-\_\-array@{exchange\-\_\-array}}
\index{exchange\-\_\-array@{exchange\-\_\-array}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{exchange\-\_\-array}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ exchange\-\_\-array)(const uint16\-\_\-t $\ast$, uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_a9bb35941a1c307a87268f643dcf14397}


Exchange data array (Master). Allows a full-\/duplex data transmission where the module will transmit an array of 16-\/bit data to a slave and receive another. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                                Example: where SPI1 and SPI0 are connected
                                    SPI[1].show_array((uint16_t*)"PWM enabled.\0\0",7,1);
                                    SPI[0].exchange_array((uint16_t*)"Show me your UART status.\0\0\0", RX_data,14,1);
                                    while (!(SPI[1].Completed && SPI[0].Completed)){}

                                Result:
                                TX_data =  "Show me your UART status.\0\0\0"
                                RX_data =  "PWM enabled.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em const} & uint16\-\_\-t$\ast$ T\-X\-\_\-data\-: give the adress of the T\-X data array to be sent.\par
 \\
\hline
{\em uint16\-\_\-t$\ast$} & R\-X\-\_\-data \-: address of R\-X data storage array.\par
 \\
\hline
{\em int8\-\_\-t} & size\-: size of the data array\par
 \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 363 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_aead12928b2c4e6898c71c73b32315770}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!init@{init}}
\index{init@{init}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{init}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ init)(int8\-\_\-t, int32\-\_\-t)}}\label{struct___s_p_i___d_r_v_aead12928b2c4e6898c71c73b32315770}


Initiatlisation method. Must be called before using the driver.\par
. 

\begin{DoxyVerb}                Example: SPI[0].init(SPI_BAUD_62500, SPI_DELAY_DEFAULT);
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em int8\-\_\-t} & baud\-\_\-rate \-: use an 8-\/bit baud-\/rate macro,\par
 \\
\hline
{\em int32\-\_\-t} & delay \-: use a 32-\/bit delay attributes macro.\par
 \\
\hline
\end{DoxyParams}


Definition at line 308 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a5f87e1c352b3224fe2a6bed5db0ccf12}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!listen@{listen}}
\index{listen@{listen}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{listen}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ listen)(uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_a5f87e1c352b3224fe2a6bed5db0ccf12}


Read data array, given size (Slave). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a master. Can be used for data sniffing. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                            Example: where SPI1 and SPI0 are connected          
                                    SPI[1].write_array((uint16_t*)"Coucou!\0",4,1);                                                             
                                    while (!(SPI[0].Completed && SPI[1].Completed)){}
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & R\-X\-\_\-data \-: give the adress where R\-X data will be stored\par
 \\
\hline
{\em int8\-\_\-t} & size\-: size of the data array \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 419 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_adca794807f12ed1014f0e08fbf17c695}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!listen\-\_\-till@{listen\-\_\-till}}
\index{listen\-\_\-till@{listen\-\_\-till}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{listen\-\_\-till}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ listen\-\_\-till)(uint16\-\_\-t $\ast$, uint16\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_adca794807f12ed1014f0e08fbf17c695}


Read data array, given terminating data (Slave). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a master until it receives a terminating data. Can be used for data sniffing. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                            Example: where SPI1 and SPI0 are connected
                                SPI[1].listen_till((RxData+60), 0,1);
                                SPI[0].write_array((uint16_t*)"The night is dark, and full of terror.\0\0",20,1);
                                while (!(SPI[1].Completed && SPI[0].Completed)){}
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & R\-X\-\_\-data \-: give the adress where R\-X data will be stored\par
 \\
\hline
{\em uint16\-\_\-t} & end\-\_\-data\-: the R\-X data that will put and end to the transfer \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 436 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a0394bc0b91f6bb1a769c0f6added863a}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!read@{read}}
\index{read@{read}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{read}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ read)(uint16\-\_\-t $\ast$)}}\label{struct___s_p_i___d_r_v_a0394bc0b91f6bb1a769c0f6added863a}


Read data (Master). Allows a half-\/duplex data transmission where the module will receive a 16-\/bit data from a slave and send it an empty frame.\par
. 

\begin{DoxyVerb}            Example:        uint16_t i;
                            SPI[0].read(&i);
            Received data is stored in i.
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & R\-X\-\_\-data \-: give the adress where R\-X data will be stored\par
 \\
\hline
\end{DoxyParams}


Definition at line 338 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_acacca74950b68d3dfeeb4b43d5a17234}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!read\-\_\-array@{read\-\_\-array}}
\index{read\-\_\-array@{read\-\_\-array}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{read\-\_\-array}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ read\-\_\-array)(uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_acacca74950b68d3dfeeb4b43d5a17234}


Read data array (Master). Allows a half-\/duplex data transmission where the module will receive an array of 16-\/bit data from a slave and send it empty frames. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                            Example: where SPI1 and SPI0 are connected          
                                    SPI[1].show_array((uint16_t*)"Lannisters send their regards.",16,1);
                                    SPI[0].read_array(RxData+85,16,0);                                                              
                                    while (!(SPI[0].Completed && SPI[1].Completed)){}
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & R\-X\-\_\-data \-: give the adress where R\-X data will be stored\par
 \\
\hline
{\em int8\-\_\-t} & size\-: size of the data array \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 402 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a8c2a4272a8f7cb28ef5cb93d2bbdfe7b}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!R\-X\-\_\-\-Data@{R\-X\-\_\-\-Data}}
\index{R\-X\-\_\-\-Data@{R\-X\-\_\-\-Data}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{R\-X\-\_\-\-Data}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t$\ast$ R\-X\-\_\-\-Data}}\label{struct___s_p_i___d_r_v_a8c2a4272a8f7cb28ef5cb93d2bbdfe7b}
A pointer to the received data (array or not). 

Definition at line 294 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a9dae312df8e91e96acbefc6054b9b33d}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!R\-X\-\_\-\-Data\-\_\-\-Size@{R\-X\-\_\-\-Data\-\_\-\-Size}}
\index{R\-X\-\_\-\-Data\-\_\-\-Size@{R\-X\-\_\-\-Data\-\_\-\-Size}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{R\-X\-\_\-\-Data\-\_\-\-Size}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t R\-X\-\_\-\-Data\-\_\-\-Size}}\label{struct___s_p_i___d_r_v_a9dae312df8e91e96acbefc6054b9b33d}
A variable that holds R\-X\-\_\-\-Data's size once a transfer is completed. 

Definition at line 297 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_ad272ecadea65ca00df2f0cc9e868ab66}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!R\-X\-\_\-end\-\_\-data@{R\-X\-\_\-end\-\_\-data}}
\index{R\-X\-\_\-end\-\_\-data@{R\-X\-\_\-end\-\_\-data}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{R\-X\-\_\-end\-\_\-data}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t R\-X\-\_\-end\-\_\-data}}\label{struct___s_p_i___d_r_v_ad272ecadea65ca00df2f0cc9e868ab66}
A value used as the terminating character of the R\-X\-\_\-array while listening/sniffing to an undetermined amount of data. (Limited to S\-P\-I\-\_\-\-M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E) 

Definition at line 295 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_af48cc5f7cde524793956f5d7b3223b48}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!R\-X\-\_\-\-Index@{R\-X\-\_\-\-Index}}
\index{R\-X\-\_\-\-Index@{R\-X\-\_\-\-Index}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{R\-X\-\_\-\-Index}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t R\-X\-\_\-\-Index}}\label{struct___s_p_i___d_r_v_af48cc5f7cde524793956f5d7b3223b48}
An internal index used for writing data to the R\-X array. 

Definition at line 298 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a086ad89b79b23005b984e80dc5e65b92}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!show@{show}}
\index{show@{show}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{show}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ show)(const uint16\-\_\-t $\ast$, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_a086ad89b79b23005b984e80dc5e65b92}


Write data (Slave). The module will write the data to its T\-X\-\_\-\-Buffer as a slave, ready to be read by a master. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}            Example:        uint16_t i=0xD6E1;
                            SPI[0].show(&i,1);
            0xD6E1 is ready to be read by a master.
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & T\-X\-\_\-data \-: give the adress of the T\-X data to be sent.\par
 \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 348 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_aa5e2288fb7202e84696e40a0e35b16b7}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!show\-\_\-array@{show\-\_\-array}}
\index{show\-\_\-array@{show\-\_\-array}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{show\-\_\-array}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ show\-\_\-array)(const uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_aa5e2288fb7202e84696e40a0e35b16b7}


Write data array (Slave). The module will write the data to its T\-X\-\_\-\-Buffer as a slave, ready to be read by a master.\-The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                            Example: where SPI1 and SPI0 are connected          
                                    SPI[1].show_array((uint16_t*)"Lannisters send their regards.",16,1);
                                    SPI[0].read_array(RxData+85,16,0);                                                              
                                    while (!(SPI[0].Completed && SPI[1].Completed)){}
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & T\-X\-\_\-data \-: give the adress of the T\-X data to be sent.\par
 \\
\hline
{\em int8\-\_\-t} & size\-: size of the data array \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 455 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a9ac4c1f881137da2601ed5d333bb5989}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!State@{State}}
\index{State@{State}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{State}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t State}}\label{struct___s_p_i___d_r_v_a9ac4c1f881137da2601ed5d333bb5989}
An internal state variable used in Transfer Complete interrupts\-:\par
 0x\-F\-F\-: idle,\par
 0x01\-: master/slave tx\par
 0x02\-: slave rx(known array size)\par
 0x03\-: slave rx(known terminating data)\par
 

Definition at line 303 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_aeeb6d504e17e93b5f68871a8902a1192}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!T\-X\-\_\-\-Data@{T\-X\-\_\-\-Data}}
\index{T\-X\-\_\-\-Data@{T\-X\-\_\-\-Data}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{T\-X\-\_\-\-Data}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t$\ast$ T\-X\-\_\-\-Data}}\label{struct___s_p_i___d_r_v_aeeb6d504e17e93b5f68871a8902a1192}
A pointer to the transmitted data (array or not). 

Definition at line 299 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a60813ca9863f226c3985a2ea529d6699}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!T\-X\-\_\-\-Data\-\_\-\-Size@{T\-X\-\_\-\-Data\-\_\-\-Size}}
\index{T\-X\-\_\-\-Data\-\_\-\-Size@{T\-X\-\_\-\-Data\-\_\-\-Size}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{T\-X\-\_\-\-Data\-\_\-\-Size}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t T\-X\-\_\-\-Data\-\_\-\-Size}}\label{struct___s_p_i___d_r_v_a60813ca9863f226c3985a2ea529d6699}
A variable that holds T\-X\-\_\-\-Data's size once a transfer is started. 

Definition at line 300 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_abb6d2bd838d651ea1ce4f67842aa81c4}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!T\-X\-\_\-\-Index@{T\-X\-\_\-\-Index}}
\index{T\-X\-\_\-\-Index@{T\-X\-\_\-\-Index}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{T\-X\-\_\-\-Index}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t T\-X\-\_\-\-Index}}\label{struct___s_p_i___d_r_v_abb6d2bd838d651ea1ce4f67842aa81c4}
An internal index used for writing data to the T\-X array. 

Definition at line 301 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a247fbfc90fac794d9c14e81848e53443}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!write@{write}}
\index{write@{write}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{write}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ write)(const uint16\-\_\-t $\ast$)}}\label{struct___s_p_i___d_r_v_a247fbfc90fac794d9c14e81848e53443}


Write data (Master). Allows a half-\/duplex data transmission where the module will transmit a 16-\/bit data to a slave.\par
. 

\begin{DoxyVerb}            Example:        uint16_t i=0xD6E1;
                            SPI[0].write(&i);
            0xD6E1 is sent to a slave.
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & T\-X\-\_\-data \-: give the adress of the T\-X data to be sent.\par
 \\
\hline
\end{DoxyParams}


Definition at line 328 of file spi\-\_\-drv.\-h.

\hypertarget{struct___s_p_i___d_r_v_a41173e3adcf94d40c1aaa34767bf638f}{\index{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}!write\-\_\-array@{write\-\_\-array}}
\index{write\-\_\-array@{write\-\_\-array}!_SPI_DRV@{\-\_\-\-S\-P\-I\-\_\-\-D\-R\-V}}
\subsubsection[{write\-\_\-array}]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ write\-\_\-array)(const uint16\-\_\-t $\ast$, int8\-\_\-t, int8\-\_\-t)}}\label{struct___s_p_i___d_r_v_a41173e3adcf94d40c1aaa34767bf638f}


Write data array (Master). Allows a half-\/duplex data transmission where the module will transmit an array of 16-\/bit data to a slave. The size of the array is limited by the M\-A\-X\-\_\-\-D\-A\-T\-A\-\_\-\-S\-I\-Z\-E macro. It can either run on foreground, in which case the program will wait for the data to be transferred, or it can also run in background, but calling another method of the driver before this data is read will result in its loss. Therefore always wait for the Completed flag before moving on.\par
. 

\begin{DoxyVerb}                                Example: where SPI1 and SPI0 are connected
                                    SPI[1].listen_till((RxData+60), 0,1);
                                    SPI[0].write_array((uint16_t*)"The night is dark, and full of terror.\0\0",20,1);
                                    while (!(SPI[1].Completed && SPI[0].Completed)){}
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em uint16\-\_\-t$\ast$} & T\-X\-\_\-data\-: give the adress of the T\-X data array to be sent.\par
 \\
\hline
{\em int8\-\_\-t} & size\-: size of the data array \\
\hline
{\em int8\-\_\-t} & intrpt\-\_\-en\-: if not null the method will run in the background, else foreground.\par
 \\
\hline
\end{DoxyParams}


Definition at line 385 of file spi\-\_\-drv.\-h.



The documentation for this struct was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
drv/\hyperlink{spi__drv_8h}{spi\-\_\-drv.\-h}\end{DoxyCompactItemize}
